// @ts-check
import { Command, logger, ModeOptions, createServer } from "f2e-server3"

const app = new Command('app')
    .option('-m, --mode <mode>', 'server mode: dev, build or prod', 'dev', ModeOptions)
    .action(async (options) => {
        const { mode } = options
        logger.setLevel('DEBUG')
        createServer({
            mode,
            gzip: true,
            buildFilter: pathname => /^(index|assets|$)/.test(pathname),
            watchFilter: pathname => /^(index|assets|src|$)/.test(pathname),
            outputFilter: pathname => /^(index|assets|static|$)/.test(pathname),
            less: {
                entryPoints: [
                    {
                        in: 'css/style.less',
                        out: 'static/style.css',
                    },
                ],
            },
            try_files: 'index.html',
            dest: 'output',
        })
    })

app.parse(process.argv)
